package com.ibeeking.found.content.api.feign.fallback;

import com.ibeeking.found.content.api.feign.MsgMaInfoFeignBClient;
import com.ibeeking.nematos.utils.result.ResponseCodeEnum;
import com.ibeeking.nematos.utils.result.ResponseResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import com.ibeeking.found.content.api.common.dto.MaInfoDTO;
/**
 * 消息服务-微信小程序配置-降级工场
 *
 * @Author ibeeking
 * @date 2019/1/18
 */
@Component
public class MsgMaInfoBFallbackFactory implements FallbackFactory<MsgMaInfoFeignBClient> {
    @Override
    public MsgMaInfoFeignBClient create(Throwable throwable) {
        return new MsgMaInfoFeignBClient() {
            @Override
            public ResponseResult<MaInfoDTO> queryMaInfo() {
                return ResponseResult.fail(ResponseCodeEnum.SYSTEM_ERROR.getCode(), "进入降级工厂，获取消息服务-微信小程序配置信息失败。" + throwable.getMessage());
            }
        };
    }
}
